package com.ruoyi.youtian.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.youtian.domain.vo.EarlyWarninVo;
import com.ruoyi.youtian.domain.vo.PieChartVo;
import com.ruoyi.youtian.service.EarlyWarninService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.ruoyi.common.utils.PageUtils.startPage;


/**
 * 设备统计告警
 */

@RestController
@RequestMapping("/youtian/EarlyWarnin")
public class EarlyWarninController {

    @Autowired
    private EarlyWarninService earlyWarninService;



    /**
     * 设备列表
     * @param earlyWarninVo
     * @return
     */
    @GetMapping("/getEquipmentlist")
    @ResponseBody
    public TableDataInfo getEquipmentlist(EarlyWarninVo earlyWarninVo){
        startPage();
        List<EarlyWarninVo> equipmentlist = earlyWarninService.getEquipmentlist(earlyWarninVo);
        return new TableDataInfo(equipmentlist,equipmentlist.size());
    }


    /**
     * 饼图
     * @param earlyWarninVo
     * @return
     */
    @GetMapping("/getPieChart")
    @ResponseBody
    public AjaxResult getPieChart(EarlyWarninVo earlyWarninVo){
        return earlyWarninService.getPieChart(earlyWarninVo);
    }


    /**
     * 柱图
     * @param earlyWarninVo
     * @return
     */
    @GetMapping("/getColumndiagram")
    @ResponseBody
    public AjaxResult getColumndiagram(EarlyWarninVo earlyWarninVo){
        return earlyWarninService.getColumndiagram(earlyWarninVo);
    }
}

